<?php
if ((isset($_POST['submit']) && ($_POST['submit'] == "Send"))) {
  require('includes/class.main.php');
  $manager = new MeetingManager();

  $date = date('Y-m-d'); 
  $time = date('h:i:s A');
  $name = $_POST['name'];
  $email = $_POST['email'];
  $phone = $_POST['phone'];
  $regarding = trim(strtolower($_POST['regarding']));
  $comments = $_POST['comments'];

  $message  = "The following feedback was submitted from the website on $date at $time.\n\n";

  $message .= "---------------------------------------------------------------------\n\n";
  $message .= "Name: $name\n";
  $message .= "Email: $email\n";
  $message .= "Phone: $phone\n\n";
  $message .= "Comments:\n$comments\n";
  $message .= "---------------------------------------------------------------------\n\n";

  $message .= "THIS EMAIL WAS SENT ANONOMOUSLY! PLEASE DO NOT REPLY TO THIS MESSAGE!\n\n";

  $message = wordwrap($message, 75);

  $to      = '"Atlanta Central Office Website" <atlantaaa@mindspring.com>'. ', ';
  //$to     .= '"Marc Mamane" <marc@mamane.org>';
  $subject = 'Website feedback regarding '. $regarding;
  $headers = 'From: "Atlanta Central Office Website" <atlantaaa@mindspring.com>' . "\r\n" .
             'Reply-To: "Atlanta Central Office Website" <atlantaaa@mindspring.com>' . "\r\n" .
             'X-Mailer: PHP/' . phpversion();

  if(!mail($to, $subject, $message, $headers)) {
    $error = "We encountered difficulties sending your email.  Please use another method to contact Central Office.<br>\n"; 
  }
}
?>
<? include('template/header.php'); ?>

<div class="left">
  <div class="blurb">
  <b><span class="blue">A.A. Central Office</span></b><br>
  127 Peachtree Street, Suite 1310<br>
  Atlanta, GA 30303<br>
  (404) 525-3178<br>
  </div>

  <div class="blurb">
  <b><span class="blue">After Hours Hotline</span></b><br>
  You can call (404) 525-3178 anytime of day or night to reach volunteers for help or information on A.A. meetings 
  and programs. There are over 1,100 A.A. meetings each week in Atlanta.
  </div>

  <div class="blurb">
  <b><span class="blue">Webmaster</span></b><br>
  We're interested in what you have to say about our site.  Please send criticisms and suggestions to our
  <a href="mailto:atlantaaa@mindspring.com">webmaster</a>.  If your area is interested in a similar site then please
  let us know!
  </div>
</div>	

<div class="right">
  <h1><span class="blue">Contact Us</span></h1><br>

  If your matter is not urgent, please feel free to contact us via the form below.  We will respond promptly!<br><br>

  <form method="post">
  
  <table>

  <tr>
  <td>
  Name:<br><br>
  </td>
  <td>
  <input type="text" name="name" size=40><br><br>
  </td>
  </tr>

  <tr>
  <td>
  Email Address:<br><br>
  </td>
  <td>
  <input type="text" name="email" size=40><br><br>
  </td>
  </tr>

  <tr>
  <td>
  Phone Number:<br><br>
  </td>
  <td>
  <input type="text" name="phone" size=40><br><br>
  </td>
  </tr>

  <tr>
  <td>
  Regarding:<br><br>
  </td>
  <td>
  <select name="regarding">
  <option>General Inquiry</option>
  <option>Service Work</option>
  <option>Feedback</option>
  </select><br><br>
  </td>
  </tr>

  <tr>
  <td valign="top">
  Comments:
  </td>
  <td>
  <textarea rows=10 cols=40 name="comments"></textarea>
  </td>
  </tr>

  <tr>
  <td colspan=2 align="right">
  <input type="submit" name="submit" value="Send">
  </td>
  </tr>

  </table>

  </form>

  <?
  if (isset($error)) {
    print $error;
  } elseif(isset($_POST['submit']) && $_POST['submit'] == "Send") {
    print "Your message has been sent!<br>\n";
  }
  ?>

</div>	

<? include('template/footer.php'); ?>
